<?php
require '../Yucy/Bootstrap.php';
class testController extends YucyController
{
	public function indexAction()
	{
		
		// 日志使用例子
		YucyConfig::set('log_path', dirname(__FILE__) . DS . 'test_log' . DS);
		YucyConfig::set('template_path', dirname(__FILE__). '/');
		$obj_logger = Yucy::getApp()->getLogger();
		$obj_logger->save('测试日志'. time());
		
		// 获取视图对象
		$obj_view = $this->getView('php');
		$obj_view->setTemplate('test.test');
		$obj_view->assign('now_time', time());
		$obj_view->assign('say', 'Hello world!');
		
		// 缓存的使用
		$obj_cache = Yucy::getApp()->getHelper()->getCache(YucyConfig::get('cache_config'));
		$obj_cache->set('test', '测试缓存');
		$data = $obj_cache->get('test');
		$obj_view->assign('cache_data', $data);
		
		//$obj_db = Yucy::getApp()->getHelper()->getDb(YucyConfig::get('db_config'));
		//$obj_db->setTable('test')->setWhere($obj_db->where(), $obj_db->orWhere());
		// SELECT * FROM test WHERE a=b AND c=1 AND t=2 OR d=3;
		
		//var_dump($obj_view, $obj_cache, $obj_db, $obj_tester, $data, $tester_time);
		//var_dump('hello world');
		$obj_view->output();
	}
}
YucyConfig::set('controller_default_name', 'test');
Yucy::getApp()->run();